<?php
require_once "includes/pagination.php";
$itemPerPage=10;
	
class search {

	function searchProduct($keyword,$page,$itemPerPage) {
		$startLimit = ($page-1) * $itemPerPage; 
		$sql = "SELECT * FROM tbl_product where product_name LIKE '%$keyword%' LIMIT $startLimit,$itemPerPage";
		$rst = mysql_query($sql);
		$num = mysql_num_rows($rst);
		if($num > 0) {
			while($row = mysql_fetch_array($rst)) {
				$data[] = $row;
			}
			return $data;
		}
		else {
			return false;
		}
	}
	
	function pagingLink($keyword) {		
		   
		   $sql = "SELECT * FROM tbl_product where product_name LIKE '%$keyword%'";
		   $rst = mysql_query(getPagingQuery($sql,'3'));
		   echo "<div align='center'>";
			   $link="search";
			   echo $disp=getPagingLink($sql,'3',$link);							   
		   echo "</div>"; 
	}
}
?>